﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace WinFormSocketServer
{
    /// <summary>
    /// 存储一个对话
    /// </summary>
    public class Session
    {
        /// <summary>
        /// 客户端 socket
        /// </summary>
        public Socket ClientSocket { get; set; }

        /// <summary>
        /// 客户端Ip
        /// </summary>
        public string IP { get; set; }

        public Session(Socket clientSocket)
        {
            this.ClientSocket = clientSocket;
            this.IP = GetIPString();
        }
        public string GetIPString()
        {
            string result = ((IPEndPoint)ClientSocket.RemoteEndPoint).Address.ToString();
            return result;
        }

    }
}
